package tv.acgn.advertisement.search.breaker;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import tv.acgn.advertisement.publish.api.vo.adplan.AdPlanRequestVO;
import tv.acgn.advertisement.search.client.AdPublishClient;
import tv.acgn.advertisement.servicebase.exception.AbstractAdSysBusinessException;
import tv.acgn.advertisement.servicebase.factory.CommonResponseFactory;
import tv.acgn.advertisement.servicebase.vo.CommonResponse;

/**
 * @author : junG
 * @program : advertisement-ad-search-breaker
 * @description : AdPublish 服务调用的断路器
 * @date : 2019-06-16 19:10
 **/

@Component
@Slf4j
public class AdPublishClientBreaker implements AdPublishClient {
    @Override
    public CommonResponse getAdPlan(String id) throws AbstractAdSysBusinessException {
        log.error("AdPublishClient#getAdPlan 接口调用错误 发生熔断 入参 id={}", id);
        return CommonResponseFactory.circuitBreakerResponse();
    }

    /**
     * <h2>查找推广计划</h2>
     *
     * @param requestVO [1] 请求查询参数
     *
     * @return {@link CommonResponse}
     *
     * @throws AbstractAdSysBusinessException 异常
     * @author junG
     * @description 查找推广计划
     * @date 21:22 2019/6/30
     */
    @Override
    public CommonResponse findAdPlan(AdPlanRequestVO requestVO) throws AbstractAdSysBusinessException {
        log.error("AdPublishClient#findAdPlan 接口调用错误 发生熔断 入参 requestVO={}", requestVO);
        return CommonResponseFactory.circuitBreakerResponse();
    }
}
